package com.example.lenovo.liweixin1601v20180702.p;

import android.util.Log;

import com.example.lenovo.liweixin1601v20180702.m.bean.NewBean;
import com.example.lenovo.liweixin1601v20180702.m.http.HttpConfig;
import com.example.lenovo.liweixin1601v20180702.m.model.GetNewListener;
import com.example.lenovo.liweixin1601v20180702.m.model.Imodel;
import com.example.lenovo.liweixin1601v20180702.v.view.IMoadView;
import com.google.gson.Gson;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by lenovo on 2018/7/2.
 */

public class Presenter implements Ipres{
    private IMoadView iMoadView;

    @Override
    public void showToView(Imodel imodel,final IMoadView iMoadView) {
        Map<String,String>map=new HashMap();
        String url= HttpConfig.new_url;
        imodel.getNewData(url, map, new GetNewListener() {
            @Override
            public void getSuccess(String json) {
                Log.d("成功", "getSuccess: ");
                Gson gson = new Gson();
                NewBean newBean = gson.fromJson(json, NewBean.class);

            }

            @Override
            public void getError(String error) {
                Log.d("失败", "getError: ");
            }
        });
    }
    //防止内存泄漏
    public void onDestory(){
        if (iMoadView!=null){
            iMoadView=null;
        }
    }
}
